home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / djgpp.faq < prev    next >
Text File  |  1994-08-07  |  14KB  |  268 lines

  1. Q: What's the minimum set of .zip files I need for compiling programs?
  2. A: djeoeXXX, djdevXXX, gccXXXbn, gasXXXbn, and bnuXXbn are required.  The
  3.    remainder are for additional functionality.  Note that the version
  4.    numbers do not neccessarily match between FSF programs (gas and gcc)
  5.    and my programs (go32).  You'll also need bsnXXXbn for bison and
  6.    flxXXXbn for flex, where XXX is the version number.
  7.    
  8.    Note that C++ requires gppXXX.zip, and ObjectiveC requires objcXXX.zip.
  9.    The C++ library includes obstacks, alloca, and regex, so you need to
  10.    get gppXXX.zip to use them (libgpl.a)
  11.  
  12. Q: I need 1.12.maint1!
  13. A: Get and install dj112m1.zip (and dj112m2.zip, etc).  These are
  14.    maintainence releases, and include updates to go32 and other programs.
  15.    They should be installed in order and after all other modules.
  16.  
  17. Q: What about documentation?
  18. A: Get txiXXX.bn, which includes INFO.EXE.  Unpack it and run "info".  It
  19.    will bring up a (hopefully) self-explanatory online help system.
  20.  
  21.    For go32 and programs I wrote, get djdocXXX.zip, which includes the
  22.    data files for the online help system.
  23.  
  24.    For the FSF utilities, djgpp includes three files each.  Example:
  25.     gcc257bn.zip - binaries & source diffs for gcc 2.5.7
  26.     gcc257dc.zip - documentation for gcc 2.5.7
  27.     gcc257sr.zip - original FSF sources for gcc 2.5.7
  28.  
  29.    (Some sources are too big, and are split into multiple zips, all
  30.    of which must be unzipped to get a complete source distribution:
  31.         gcc257s1.zip
  32.         gcc257s2.zip
  33.         gcc257s3.zip
  34.    All sources are shipped in ready-to-build form.  The diffs in
  35.    the diffs directory have already been applied.)
  36.  
  37. Q: How do I find out what go32 is doing?
  38. A: The first thing to do is run "go32".  It will give you gobs of
  39.    information about what it knows about your system and itself.
  40.    Next, set the "topline" flag in the GO32 environment varable
  41.    (see the README) and watch the top line of your screen.  The
  42.    info there tells you something about what the program is doing.
  43.  
  44. Q: I get errors I can't figure out when I try to compile something.
  45. A: The best way to figure out what's going wrong with gcc is to
  46.    use the "-v" switch.  For example, if you run "gcc -v hello.c"
  47.    (assuming you have hello.c), it will tell you all the programs
  48.    it is running.  Then, you can see which program caused the
  49.    error.  The most likely cause of errors relating to missing
  50.    programs is that you haven't unpacked the zip file with
  51.    one of the compiler passes or utilities on it. 
  52.  
  53. Q: Why do I get so many unresolved symbols when linking C++ programs?
  54. A: The C++ libraries are not in libc.a, which is the only default
  55.    library.  You must use a command like this:
  56.        gcc -o prog prog.o -lgpp -lm
  57.    Note that some C++ classes use math routines, so the -lm should be
  58.    given after the -lgplus.  If you don't link with -lgpl or -lgpp,
  59.    you won't include any GPL code in your application.  You may not
  60.    need all of these libraries for your program. 
  61.  
  62. Q: How do I debug my programs?
  63. A: First, remember to use the -g switch when you compile.  This puts debugging
  64.    information into your executable.  Then, to debug the program, use a
  65.    command line like this:
  66.       go32 -d edebug32 myprog
  67.    "edebug32" is the external debugger.  See the file "edebug32.doc" for
  68.    information on the debugger commands.  Note: if you are running in a
  69.    DPMI environment, you must use "ed32-dpmi" instead of "edebug32".  Go32
  70.    normally searches relative to the current directory, then from it's own
  71.    directory, then the PATH, for the external debugger program. 
  72.  
  73. Q: When I run my programs under Windows, they crash, but not outside of
  74.    Windows.
  75. A: You may have used the "-fomit-frame-pointer" option to GCC.  This
  76.    tells gcc that it can use EBP as a general register.  However, the
  77.    segment used for the stack is protected against access outside of
  78.    calculated stack range, and EBP causes the stack selector to be used.
  79.    If you use this to access memory in the regular data area, you get
  80.    a protection fault.  This mechanism is present to prevent you from
  81.    using so much stack that you begin corrupting data.  Outside of
  82.    Windows, a different method is used to detect stack overrun, so you
  83.    don't see this fault.
  84.  
  85. Q: How do I create symbolic links?
  86. A: Copy bin/stub.exe to the name of the link you want.  In this example,
  87.    let's say the real program is dj1.exe and we want to make a link called
  88.    dj2.exe that really calls dj1.exe.  We'd copy stub.exe to dj2.exe.
  89.    Next, run stubedit to modify the new programs' stub info block to change
  90.    the name of the executable it runs.  In this case, we'd change it to
  91.    dj1.  When you run dj2 now, it tells go32 to use the image of dj1.
  92.      C:\> copy c:\djgpp\bin\stub.exe c:\usr\bin\dj2.exe
  93.      C:\> stubedit c:/usr/bin/dj2.exe runfile=dj1
  94.  
  95. Q: When I run "gcc e:\proj\prog.c" it says "undefined escape sequence \p"?
  96. A: Gcc is a *unix* compiler - you must use *unix* slashes (e:/proj/prog.c).
  97.    Environment variables (like GCCINC) may, however, use either, as they
  98.    are converted.
  99.  
  100. Q: I type "GCC PROG.C" and ld complains about PROG.C not being an object.
  101. Q: I type "gcc prog.cxx" to compile a C++ program, and ld complains.
  102. A: Gcc is *not* case insensitive like DOS is, and it uses the file's
  103.    extension to determine how to compile a file.  Valid extensions are:
  104.      .cc = C++ source (passed through cpp)
  105.      .c = C source that must be passed through cpp first
  106.      .i = raw C source (no cpp pass)
  107.      .S = assembler that must be passed through cpp first
  108.      .s = raw assembler source (no cpp pass)
  109.    any other file is passed to the linker
  110.  
  111. Q: I compile my program, but can't run the output file.
  112. A: DOS doesn't know how to run unix-style COFF files.  That's what the
  113.    extender is for.  To run an COFF file called myprog, type
  114.      "go32 myprog . . ."
  115.  
  116. Q: I compile my program, but when I run the .exe it hangs.
  117. A: Most likely, you did this: "gcc foo.c -o foo.exe".  This doesn't
  118.    create a real .EXE file.  That's like renaming your phone directory
  119.    file to an .EXE and expecting it to run.  You must use the COFF2EXE
  120.    program to convert the output of gcc to a real executable. 
  121.  
  122. Q: Gcc doesn't recognize // as a comment in my C programs.
  123. A: That's because // isn't a comment in C.  If you want to compile C++,
  124.    then write C++ programs.  Gcc is really two compilers in one, not
  125.    one compiler that compiles both C and C++.  That's why you get
  126.    cc1 and cc1plus.
  127.  
  128. Q: I'm reading in data files, but the data gets corrupted.
  129. A: The default file type is DOS text, even for read() and write().  You must
  130.    tell the system that a file is binary through the "b" flag in fopen(),
  131.    or O_BINARY in open() or setmode().
  132.  
  133. Q: I get "fatal signal 2" when I run gcc.
  134. A: When gcc reports a "signal", it really means that an error occurred
  135.    trying to run the given program.  The "signal" number is the DOS error
  136.    code, and 2 means "file not found".  Check the COMPILER_PATH environment
  137.    variable and make sure it points to the directory with cpp.exe,
  138.    cc1.exe, etc.
  139.  
  140. Q: The binaries I get with the distribution are .exe files, but gcc creates
  141.    COFF files.  I rename the COFF's to .EXE's, but they still don't work.
  142. A: To get an .EXE from an COFF, you must *prepend* either go32.exe
  143.    or stub.exe to the file.  A program called "coff2exe" is provided to
  144.    do this.  Just run "coff2exe myprog".
  145.  
  146. Q: What is stub.exe?
  147. A: Stub.exe simply calles go32.exe, and passes it information it needs to
  148.    run the COFF file attached to it.  Stub is much smaller than go32, so
  149.    less disk space is used.  Also, if you change go32, you don't have to
  150.    change stub, and all the stub-ized programs will use the new go32
  151.    automatically.
  152.  
  153. Q: I want to change cc1.  How do I do this?
  154. A: First, get the GNU sources.  These should be the "gccXXXsr.zip"
  155.    files found in the djgpp distribution.  You can also get the latest
  156.    versions from the FSF if you like.  They're usually available at
  157.    prep.ai.mit.edu in /pub/gnu, if not elsewhere.  djgpp includes a
  158.    copy of gzip (gzp124bn.zip) that can uncompress them. Use
  159.    djtarx to un-tar them, as djtarx knows how to handle unix file names
  160.    that aren't valid DOS file names.  Next, apply the "diffs" (if any)
  161.    over the GNU sources (making sure you have the right version of GNU
  162.    - see the versions file).  For most GNU utilities, you must run
  163.    "configure" to prepare the sources for a native go32 build before
  164.    building. For all other programs, just run make. Note that the makefiles
  165.    are tuned for gnu make, since it knows how to handle long command lines.
  166.    Specific instructions are documented in the diffs or in each program's
  167.    configure.bat.
  168.  
  169. Q: I don't have an 80387.  How do I compile floating point programs?
  170. A: Add "emu c:\djgpp\bin\emu387" to the GO32 environment variable
  171.    (see go32 section in readme).  This tells go32 to use the given file
  172.    as an 80387 emulator.  If you don't load this emulator, and you try
  173.    to run floating point without a 387, you will get an error.
  174.  
  175. Q: I installed an 80387 emulator in my AUTOEXEC, but it still doesn't
  176.    work.  Why?
  177. A: The CPU is running in *protected* mode, not real mode, and the information
  178.    needed to emulate the 80387 is different.  Not to mention that the
  179.    exceptions never get to the real-mode handler.  You must use the emu387
  180.    emulator, which is designed for go32.
  181.  
  182. Q: Can I run this on my 286?  It has protected mode also...
  183. A: True, but the 286 isn't a 32-bit processor.  A 386 really is required.
  184.  
  185. Q: Can I use gcc on my 512K machine?
  186. A: Yes, but the disk better have at least 4Mb of free space for paging.
  187.    Go32 will use all available extended memory (up to 128M) and up to
  188.    128M of disk space, for a grand total of 256M of virtual memory for
  189.    your application.  Try a malloc(50*1024*1024) some day.
  190.  
  191. Q: Why do my compiles are running VERY SLOW, even though I use a ramdisk
  192.    for swap and a disk cache?
  193. A: Gcc requires at least 1Mb of virtual memory to run, usually close to 1.5M.
  194.    If there isn't this much real memory available, it starts paging to disk.
  195.    It's good to leave about 1M of extended (or expanded) memory available
  196.    for go32 to run programs with.  When it needs to page a lot, you spend
  197.    most of your time paging and little time actually running.  Note that
  198.    if you are running with a VCPI server, like QEMM or 386MAX, then go32
  199.    will use *expanded* memory for it's physical memory needs, not
  200.    extended.  If you are redirecting your swap to a ramdisk, you'd be better
  201.    off turning that memory back into extended (or expanded) memory for go32
  202.    to use better.
  203.  
  204. Q: How much memory is available when I use the system() call?
  205. A: Everything but what go32 is loaded with.  The program is completely
  206.    paged out to memory (including the page tables themselves) before
  207.    the second program is executed.  Currently, this is about 130K
  208.    less than was available before go32 was executed, since go32
  209.    itself remains in memory.
  210.  
  211. Q: Go32 complains that the CPU must be in V86 mode to run.
  212. A: When the CPU is in V86 mode, the V86 manager must provide VCPI
  213.    services for go32.  Since VCPI is an extension to EMS, disabling EMS
  214.    will disable VCPI, and prevent go32 from running.  For some EMS
  215.    managers, this means that you can't use the "noems" switch. 
  216.  
  217. Q: Why can't I keep QEMM in auto/off mode?
  218. A: When QEMM is in auto/off mode and there isn't anything in the system that
  219.    is using any of QEMM's features, the CPU remains in "real" mode.  Go32
  220.    knows this, and will try to use XMS to access the extended memory.
  221.    Unfortunately, XMS is a feature that causes QEMM to turn on, and go32
  222.    doesn't know this and when it tries to switch into protected mode,
  223.    QEMM traps it and gives a protection violation warning.  Since this
  224.    always requires a system reboot to fix, go32 checks to see if enabling
  225.    XMS caused the cpu to switch into v86 mode (meaning QEMM just turned
  226.    on) and gracefully exits.  All you have to do to work around this is
  227.    force QEMM to be on all the time so that go32 will know how to work
  228.    with it properly.
  229.  
  230. Q: How do globbing and response files work?
  231. A: A response file is a file that contains stuff that goes on the command
  232.    line, but is too big for DOS.  The name of the file is given as "@file"
  233.    to any COFF program, and go32 reads the file for command line
  234.    information.  It uses single and double quotes to group parameters, and
  235.    backslashes to escape quotes, spaces, tabs, newlines, and backslashes. 
  236.    Parameters containing wildcards are expanded if they can be, else they
  237.    are unmodified.  Surrounding a parameter in single quotes will prevent
  238.    wildcards from being expanded.  This is similar to unix.  Note that
  239.    backslashes are not special if they are not in front of a quote,
  240.    whitespace, or backslash. 
  241.  
  242. Q: What is GCC-RM?  How do I use it?
  243. A: GCC is merely a driver program which calls the CCP, CC1, AS, LD images.
  244.    The real-mode gcc is simply gcc itself compiled with Turbo-C instead of
  245.    Gcc.  This improves compile times on most systems, but isn't as
  246.    "clean" as the 32-bit compiled version, and also the 32-bit version
  247.    can be recompiled (FSF desires) without having to purchase a new
  248.    compiler.  Both versions should produce exactly the same output, but
  249.    if you have any problems (such as under Novell) use the 32 bit version.
  250.    You can either put GCC-RM in your path and issue GCC as your compile
  251.    command, or copy it to the bin directory (saving the 32 bit GCC.EXE first).
  252.    GCC-RM does not create 16 bit code, or allow the compiler to work on
  253.    16 bit only machines.
  254.  
  255. Q: Is GDB available for DJGPP?
  256. A: Yes, see gdbXXXbn.zip.  Note that it doesn't work exactly like the Unix
  257.    versions.  For example, you can't pass command line parameters to gdb,
  258.    and you can only start the program once.
  259.  
  260. Q: Where is the "make" utility?
  261. A: makXXXbn.zip contains the make utility.
  262.  
  263. Q: Why can't I get segment registers to work in go32 programs?
  264. A: Because segments work differently in protected mode.  For most cases, you
  265.    will not need to use segments.  The "small" model allows up to
  266.    2 Gb of data space before you run out, so there's no need
  267.    for far pointers anyway.
  268.